﻿using Architecture.Api.Application.Command.RoleCommand;
using Architecture.Domain.Dto;
using Architecture.Domain.RBAC;
using Architecture.Service;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.RoleHandler
{
    public class RoleShowCommandHandler : IRequestHandler<RoleShowCommand, PageListDto<Role>>
    {
        private readonly IRoleService _roleService;

        public RoleShowCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }
        public async Task<PageListDto<Role>> Handle(RoleShowCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetAllAsync(request.pageIndex,request.pageSize,request.roleName);
        }
    }
}
